// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h"
#include "content/public/test/browser_test.h"

namespace web_app {

namespace {

using WebAppIntegrationBrowserTestMacWinLinux = WebAppIntegrationBrowserTest;

// Manual tests:

IN_PROC_BROWSER_TEST_F(WebAppIntegrationBrowserTestMacWinLinux,
                       CheckAppShortcutExists) {
  helper_.InstallCreateShortcutWindowed("SiteA");
  helper_.CheckAppShortcutExists("SiteA");
}

IN_PROC_BROWSER_TEST_F(WebAppIntegrationBrowserTestMacWinLinux,
                       CheckPolicyAppUninstallWorks) {
  helper_.InstallPolicyAppWindowedShortcut("SiteA");
  helper_.CheckAppShortcutExists("SiteA");
  helper_.UninstallPolicyApp("SiteA");
  helper_.CheckAppShortcutNotExists("SiteA");
}

// Generated tests:

IN_PROC_BROWSER_TEST_F(
    WebAppIntegrationBrowserTestMacWinLinux,
    WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_UninstallFromMenuSiteA_NotInListSiteA_NavSiteA_InstIconShown_LaunchIconNotShown) {
  // Test contents are generated by script. Please do not modify!
  // See `chrome/test/webapps/README.md` for more info.
  // Sheriffs: Disabling this test is supported.
  helper_.InstallOmniboxIcon("SiteA");
  helper_.CheckWindowCreated();
  helper_.CheckAppInListWindowed("SiteA");
  helper_.UninstallFromMenu("SiteA");
  helper_.CheckAppNotInList("SiteA");
  helper_.NavigateBrowser("SiteA");
  helper_.CheckInstallIconShown();
  helper_.CheckLaunchIconNotShown();
}

IN_PROC_BROWSER_TEST_F(
    WebAppIntegrationBrowserTestMacWinLinux,
    WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_UninstallFromMenuSiteA_NotInListSiteA_NavSiteA_InstIconShown_LaunchIconNotShown) {
  // Test contents are generated by script. Please do not modify!
  // See `chrome/test/webapps/README.md` for more info.
  // Sheriffs: Disabling this test is supported.
  helper_.InstallMenuOption("SiteA");
  helper_.CheckWindowCreated();
  helper_.CheckAppInListWindowed("SiteA");
  helper_.UninstallFromMenu("SiteA");
  helper_.CheckAppNotInList("SiteA");
  helper_.NavigateBrowser("SiteA");
  helper_.CheckInstallIconShown();
  helper_.CheckLaunchIconNotShown();
}

IN_PROC_BROWSER_TEST_F(
    WebAppIntegrationBrowserTestMacWinLinux,
    WebAppIntegration_InstCrtShctWindowedSiteA_WindowCreated_InListWinSiteA_UninstallFromMenuSiteA_NotInListSiteA_NavSiteA_InstIconShown_LaunchIconNotShown) {
  // Test contents are generated by script. Please do not modify!
  // See `chrome/test/webapps/README.md` for more info.
  // Sheriffs: Disabling this test is supported.
  helper_.InstallCreateShortcutWindowed("SiteA");
  helper_.CheckWindowCreated();
  helper_.CheckAppInListWindowed("SiteA");
  helper_.UninstallFromMenu("SiteA");
  helper_.CheckAppNotInList("SiteA");
  helper_.NavigateBrowser("SiteA");
  helper_.CheckInstallIconShown();
  helper_.CheckLaunchIconNotShown();
}

IN_PROC_BROWSER_TEST_F(
    WebAppIntegrationBrowserTestMacWinLinux,
    WebAppIntegration_InstCrtShctWindowedSiteC_InListWinSiteC_UninstallFromMenuSiteC_NotInListSiteA) {
  // Test contents are generated by script. Please do not modify!
  // See `chrome/test/webapps/README.md` for more info.
  // Sheriffs: Disabling this test is supported.
  helper_.InstallCreateShortcutWindowed("SiteC");
  helper_.CheckAppInListWindowed("SiteC");
  helper_.UninstallFromMenu("SiteC");
  helper_.CheckAppNotInList("SiteA");
}

}  // namespace
}  // namespace web_app
